\hypertarget{uniont__mix__header}{
\section{t\_\-mix\_\-header Union Reference}
\label{uniont__mix__header}\index{t\_\-mix\_\-header@{t\_\-mix\_\-header}}
}


Mix archive header.  




{\ttfamily \#include $<$mix\_\-file.h$>$}

\subsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{uniont__mix__header_acdcf512ce171789435ec0117a237b831}{
\begin{tabbing}
xx\=xx\=xx\=xx\=xx\=xx\=xx\=xx\=xx\=\kill
struct \{\\
\>unsigned short {\bfseries c\_files}\\
\>unsigned int {\bfseries size}\\
\}; }
\label{uniont__mix__header_acdcf512ce171789435ec0117a237b831}
\\

\end{tabbing}\item 
\hypertarget{uniont__mix__header_a6aaf56e60f1d90ebe9aecf77faa42f13}{
unsigned int {\bfseries flags}}
\label{uniont__mix__header_a6aaf56e60f1d90ebe9aecf77faa42f13}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Mix archive header. 

Mix archive starts with archive header storing information about number of files included and their total size. Some archives (RA/TS) starts with 4b flags, which is followed by header.

\begin{DoxyParagraph}{old mix format header}

\begin{DoxyItemize}
\item 2B -\/ number of files
\item 4B -\/ total content's size
\end{DoxyItemize}
\end{DoxyParagraph}
\begin{DoxyParagraph}{RA/TS mix format header}

\begin{DoxyItemize}
\item 4B -\/ flags
\item 2B -\/ number of files
\item 4B -\/ total content's size
\end{DoxyItemize}
\end{DoxyParagraph}
\hypertarget{uniont__mix__header_archivetype}{}\subsection{determine what type archive is}\label{uniont__mix__header_archivetype}
Now here comes part which might be hard to understand. Data are stored in little endian format, which means little ending is stored first and big ending last. Number 0x11223344, where little ending is 44, will be stored like this 44 33 22 11 -\/ bytes are stored in reverse direction as you can see.

Flags are stored only in LAST 2 bytes, that means if file starts with flags, FIRST 2 bytes are 00 00, and other 2 bytes contains flag. If there are no flags, archive can not start with 00 00, because that would mean it contains no files.

So we read header no matter what type archive is and check for first two bytes,which are stored in c\_\-files. If c\_\-files == 0, we take first 4 bytes, which are stored in flags as flag information, move file pointer to 4th byte and repeat reading of header (6b). Now c\_\-files contains number of files and size contains size of all files. 

The documentation for this union was generated from the following file:\begin{DoxyCompactItemize}
\item 
src/mix\_\-file.h\end{DoxyCompactItemize}
